<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鼠标监听时间</title>
</head>
<body>
<canvas id="canvas"></canvas>
</body>
<script>
    var canvas = document.getElementById('canvas'),
        context = canvas.getContext('2d');

    canvas.onmousedown = function (e) {
        //处理canvas的按下鼠标事件
    }

    canvas.addEventListener('mousedown',function (ev) {
        //处理canvas的按下鼠标事件
    })

</script>
</html>